package com.dy;

import java.util.*;

/**
 * Hello world!
 *
 */
class Pig{
    int year;
    int old;
    int id;
    public Pig(int year,int old,int id){
        this.year = year;
        this.old = old;
        this.id = id;
    }
    public Pig createPig(int id){
        if(this.old>=3){
            Pig pig = new Pig(this.year+this.old,1,id);
            return pig;
        }else{
            return null;
        }
    }
    public void older(){
        this.old++;
    }
}
public class App 
{
    public static void main( String[] args )
    {
        Scanner sc = new Scanner(System.in);
        String s[]  = sc.nextLine().split(",");
        int m = Integer.parseInt(s[0]);
        int k= Integer.parseInt(s[1]);
        int dp[] = new int[m];
        dp[0]=2;
        dp[1]=3;
        dp[2] = 4;
        for(int i=3;i<m;i++){
            dp[i] = dp[i-2]+dp[i-3];
        }
        System.out.println(dp[m-1]);
        List<Pig> pigs = new LinkedList<>();
        Pig one = new Pig(1,3,dp[0]);
        Pig two = new Pig(1,1,dp[1]);
        pigs.add(one);pigs.add(two);
        int size=2;
        int year=1;
        while(size<m){
            for(int i=0;i<pigs.size();i++){
                Pig pig = pigs.get(i).createPig(dp[pigs.size()]);
                if(pig!=null){
                    pigs.add(pig);
                }
                pig.older();

            }

            year++;

        }
    }
}
